#pragma once

#include "common.h"
#include "vnrwidget.h"



int VWidgetZOrderCompare(VWidget* w1, VWidget* w2);

class VContainer :
    public VNRWidget
{
protected:
    VWidgetArray* _children;


public:
    VContainer(void);
    VContainer(size_t size);
    virtual ~VContainer(void);

public: // override iterface
    virtual bool render() const;
    virtual void animate();

public: // override event
    virtual bool mouseDownEvent(int x, int y);
    virtual bool mouseUpEvent(int x, int y);
    virtual bool mouseMoveEvent(int x, int y, bool mousestat);

public:
    VWidget* at(size_t pos) const;
    VWidget* operator[](size_t pos) const;

    size_t size() const;

    virtual bool insert(VWidget* widget);
    virtual bool remove(VWidget* widget);
    virtual bool find(const VWidget* widget);

protected:    // class type
    static const CLASS_TYPE _clstype = T_CONTAINER;
public:
    virtual CLASS_TYPE classType()  const;


};
